package com.ruoyi.user.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.user.mapper.UserAddressesMapper;
import com.ruoyi.user.domain.UserAddresses;
import com.ruoyi.user.service.IUserAddressesService;

/**
 * 用户收货地址Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-10-21
 */
@Service
public class UserAddressesServiceImpl implements IUserAddressesService 
{
    @Autowired
    private UserAddressesMapper userAddressesMapper;

    /**
     * 查询用户收货地址
     * 
     * @param addressId 用户收货地址主键
     * @return 用户收货地址
     */
    @Override
    public UserAddresses selectUserAddressesByAddressId(String addressId)
    {
        return userAddressesMapper.selectUserAddressesByAddressId(addressId);
    }

    /**
     * 查询用户收货地址列表
     * 
     * @param userAddresses 用户收货地址
     * @return 用户收货地址
     */
    @Override
    public List<UserAddresses> selectUserAddressesList(UserAddresses userAddresses)
    {
        return userAddressesMapper.selectUserAddressesList(userAddresses);
    }

    /**
     * 新增用户收货地址
     * 
     * @param userAddresses 用户收货地址
     * @return 结果
     */
    @Override
    public int insertUserAddresses(UserAddresses userAddresses)
    {
        return userAddressesMapper.insertUserAddresses(userAddresses);
    }

    /**
     * 修改用户收货地址
     * 
     * @param userAddresses 用户收货地址
     * @return 结果
     */
    @Override
    public int updateUserAddresses(UserAddresses userAddresses)
    {
        return userAddressesMapper.updateUserAddresses(userAddresses);
    }

    /**
     * 批量删除用户收货地址
     * 
     * @param addressIds 需要删除的用户收货地址主键
     * @return 结果
     */
    @Override
    public int deleteUserAddressesByAddressIds(String[] addressIds)
    {
        return userAddressesMapper.deleteUserAddressesByAddressIds(addressIds);
    }

    /**
     * 删除用户收货地址信息
     * 
     * @param addressId 用户收货地址主键
     * @return 结果
     */
    @Override
    public int deleteUserAddressesByAddressId(String addressId)
    {
        return userAddressesMapper.deleteUserAddressesByAddressId(addressId);
    }

    /**
     * 根据用户ID查询用户收货地址列表
     * 
     * @param customerId 用户ID
     * @return 用户收货地址集合
     */
    @Override
    public List<UserAddresses> selectUserAddressesByCustomerId(String customerId)
    {
        return userAddressesMapper.selectUserAddressesByCustomerId(customerId);
    }

    /**
     * 根据用户ID和地址ID修改用户收货地址
     * 
     * @param userAddresses 用户收货地址
     * @return 结果
     */
    @Override
    public int updateUserAddressByCustomerIdAndAddressId(UserAddresses userAddresses)
    {
        return userAddressesMapper.updateUserAddressByCustomerIdAndAddressId(userAddresses);
    }

    /**
     * 根据用户ID和地址ID查询用户收货地址详情
     * 
     * @param customerId 用户ID
     * @param addressId 地址ID
     * @return 用户收货地址
     */
    @Override
    public UserAddresses selectUserAddressByCustomerIdAndAddressId(String customerId, String addressId)
    {
        return userAddressesMapper.selectUserAddressByCustomerIdAndAddressId(customerId, addressId);
    }

    /**
     * 根据用户ID和地址ID删除用户收货地址（软删除）
     * 
     * @param customerId 用户ID
     * @param addressId 地址ID
     * @return 结果
     */
    @Override
    public int deleteUserAddressByCustomerIdAndAddressId(String customerId, String addressId)
    {
        return userAddressesMapper.deleteUserAddressByCustomerIdAndAddressId(customerId, addressId);
    }
}
